"use strict";
/* let str:string="你好 ts"
let str1:string="hello"
let boo:boolean=false;
let array:string []=["11","aa"]
enum color {"blue"=2}
let blue:color=color.blue

function run():void{
    console.log("11")
}
function say():number{
    return 11;
}
function person(name:string,age:number):any{
    return {
        name,
        age
    }
}
function child(name:string,age?:number):void{
    if(age){
        alert( `${age}--------${name}`)
    }else{
        alert( `年龄保密------${name}`)
    }
    
}
child("zhangsna");
console.log(person("zhangsan",19))
array.push("bb")
console.log(color)
console.log(array)
console.log("hello world") */
/* function sum(...result:number[]):number{
    let sum =0;
    for(let i=0;i<result.length;i++){
        sum+=result[i]
    }
    return sum
}
alert(sum(1,2,3,4,5)) */
/* function person(name:string):string;
function person(name:string,age:number):number;
function person(name:any,age?:any):any{
    if(age){
        return `${name}-----${age}`
    }else{
        return `${name}`
    }
}
alert(person("aa"))
alert(person("bb",18)) */
/* function Person(name:string){
    this.name=name;
    this.run=function(){
        console.log("我在跑")
    }
}
var p=new Person("zhangsan ")
p.run() */
/* class Person{
    name:string;
    constructor(n:string){
        this.name=n
    }
    run():void{
        alert(this.name)
    }
}
let p=new Person("zhangsan")
p.run() */
/* class Person{
    name:string;
    constructor(name:string){
        this.name=name
    }
    getName(){
        return this.name
    }
    setName(name:string){
        this.name=name
    }
}
let p= new Person("zhangsan")
alert(p.getName())
p.setName("lisi")
alert(p.getName()) */
/* class Person{
    name:string;
    constructor(name:string){
        this.name=name
    }
    run():string{
        return `${this.name}在运动`
    }
}
class Man extends Person{
    constructor(name:string){
        super(name)
    }
}
let m =new Man("lisi");
alert(m.run());  */
/* class Person{
    name:string;
    constructor(name:string){
        this.name=name
    }
    run():string{
        return `${this.name}+在跑`
    }
}
class Man extends Person{
    constructor(name:string){
        super(name)
    }
    say():string{
        return `${this.name}+在说哈`
    }
    run():string{
        return `${this.name}+子类在说话`
    }
}
let m = new Man("lisi")
alert(m.run())
alert(m.say()) */
/* class Person{
    private name:string;
    constructor(name:string){
        this.name=name
    }
    run():string{
        return `${this.name}在跑步`
    }
}
class Man extends Person{
    constructor(name:string){
        super(name)
    }
    run():string{
        return `${this.name}子类在跑步`
    }
}
let person = new Person("wangwu")
alert(person.run())
let man = new Man("lisi")
alert(man.name)
alert(man.run()) */
/* function Person(){
    this.say=function(){
        return `在说哈`
    }
}
Person.run=function(){
    return `在跑哈`
}
Person.name="张三"
let per = new Person();
per.say();
Person.run(); */
/* function $(element){
    return new Base(element)
}
function Base(element){
    this.element="获取dom节点"
    this.css=function(attr,value){
        this.element.style.attr=value
    }
    this.get=function(url,()=>{

    })
}
$("#id").css("color","red")
$.get("url",function(){

}) */
/* $("#id").css("color", "red")
$.get("url", function () {
})
function $(element) {
    return new Base(element)
}
$.get = function () {

}
function Base(element) {
    this.element = document.querySelector(element)
    this.css(color, red){
        this.element.style.color = red;
        );
    }
} */
/* class Person{
    name:string;
    static name2:string='xi'
    constructor(name:string){
        this.name=name
    }
    run():string{
        return `${this.name}在跑步`
    }
    static say():string{
        return `${Person.name2}说话`
    }
}
alert(Person.say()) */
/* class animals {
    name:string;
    constructor(name:string) {
        this.name=name
    }
    eat():string{
        return "动物都会吃东西"
    }
}
class Sheep extends animals {
    constructor(name:string) {
        super(name)
    }
    eat():string{
        return "我是羊喜欢吃草"
    }
}
class  Dog extends animals {
    constructor(name:string) {
        super(name)
    }
    eat():string{
        return "我是dog喜欢吃肉"
    }
}
let sheep = new Sheep("sheep");
alert(sheep.eat())
let dog = new Dog("dog")
alert(dog.eat()) */
/* abstract class Animals {
    name:string;
    constructor(name:string) {
        this.name=name
    }
    abstract eat():string;
}
class Sheep extends Animals {
    
    constructor(name:string) {
        super(name)
    }
    eat():string{
        return "我是羊要吃草"
    }
}
class Dog extends Animals{
    constructor(name:string) {
        super(name)
    }
    eat():string{
        return "我是Dog要吃草"
    }
}
let sheep = new Sheep("羊")
alert(sheep.eat())
let dog = new Dog("狗")
alert(dog.eat()) */
/* function priteLable(lableInfo:{lable:string}){
    console.log(lableInfo)
}
priteLable("111")
priteLable({aa:"ss"})
priteLable({lable:"hello"}) */
/* function printName(param:{name:string}){
    alert(param.name)
}
printName({name:"lisi"}) */
/* interface param{
    firstName:string,
    lastName:string
}
function printName(param:param):string{
    return `${param.firstName}${param.lastName}`
}
alert(printName({firstName:"张",lastName:"san"})) */
/* interface FullName{
    firstName:string,
    secondName:string
}
function printName(name:FullName):void{
    alert(name)
}
printName({firstName:"张",secondName:"san"}) */
/* interface config{
    type:string,
    url:string,
    dataType:string,
    data?:string
}
function ajax(config:config){
    var xhr=new XMLHttpRequest();
    xhr.open(config.type,config.url,true)
    xhr.send(config.data)
    xhr.onreadystatechange=function(){
        if(xhr.readyState==4&&xhr.status==200){
            if(config.dataType=="json"){
                JSON.parse(xhr.responseText)
            }else{
                console.log(xhr.responseText)
            }
           
        }
    }
}
ajax({
    type:"get",
    url:"http://127.0.0.1",
    dataType:"json"
}) */
/* interface encrypt{
    (key:string,value:string):string
}
var password:encrypt=function(key:string,value:string):string{
    return key+value
}
alert(password("zhangsan","123455")) */
/* interface User{
    [index:number]:string
}
var arr:User=["aaa","bbb"]
alert(arr[0]) */
/* interface animals{
    name:string,
    eat(str:string):void
}
class  dog implements animals {
    name:string
    constructor(name:string) {
        this.name=name
    }
    eat():void{
        alert(this.name+"吃肉")
    }
}
var d = new dog("dog")
d.eat() */
/* interface animals{
    name:string
    eat(str:string):void
}
class  cat implements animals {
    name:string
    constructor(name:string) {
        this.name=name
    }
    eat(str:string):void{
        alert(this.name+"吃"+str)
    }
}
var c = new cat("猫")
c.eat("老鼠") */
/* interface animals{
    eat():void
}
interface Person extends animals{
    work():void
}
class web implements Person{
   public name:string
    constructor(name:string) {
        this.name=name
    }
    eat():void{
        alert(this.name+"吃东西")
    }
    work():void{
        alert(this.name+"写代码")
    }
}
var w =new web("lisi")
w.eat()
w.work() */
/* interface animals{
    eat():void
}
interface Person extends animals{
    work():void
}
class Programmer{
    name:string,
    constructor(name:string){
        this.name=name
    }
}
class web extends Programmer implements Person{
    constructor(name:string){
        super(name)
    }
    eat(){
        alert(this.name+"吃饭")
    }
    work(){
        alert(this.name+"工作")
    }
}
var w = new web("lisi")
w.eat()
w.work() */
/* function getDate<T>(value:T):T{
    return value
}
alert(getDate<number>(123)) */
/* class minClass{
    public arr:number[]=[];
    add(num:number):void{
        this.arr.push(num)
    }
    min():number{
         let  minValue=this.arr[0]
        for(let i=1;i<=this.arr.length;i++){
            if(minValue>this.arr[i]){
                minValue=this.arr[i]
            }
        }
        return minValue
    }
}
var m = new minClass()
m.add(10)
m.add(8)
m.add(33)
m.add(6)
alert(m.min()) */
/* class min<T>{
    public arr:T[]=[]
    add(arr:T):void{
        this.arr.push(arr)
    }
    min():T{
       let  minValue:T=this.arr[0]
       for(let i=1;i<=this.arr.length;i++){
           if(minValue>this.arr[i]){
               minValue=this.arr[i]
           }
       }
       return minValue
    }
}
var m = new min<string>();
m.add("d")
m.add("e")
m.add("b")
alert(m.min())
var numMin=new min<number>();
numMin.add(14)
numMin.add(10)
numMin.add(23)
alert(numMin.min()) */
/* interface fn{
    <T>(value:T):T
}
var getDate:fn=function<number>(){
    
} */
/* class  User {
    username:string|undefined;
    password:string|undefined;
}
class  mysqlDb {
    add(user:User):boolean{
        alert(user)
        return true
    }
}
var u=new User();
u.username="jack"
u.password="123456"
var Db=new mysqlDb();
Db.add(u) */
var ArticleCate = /** @class */ (function () {
    function ArticleCate(params) {
        this.title = params.title;
        this.desc = params.desc;
        this.status = params.status;
    }
    return ArticleCate;
}());
var art = new ArticleCate({
    title: "分类",
    desc: "1"
});
var mysqlDb = /** @class */ (function () {
    function mysqlDb() {
    }
    mysqlDb.prototype.add = function (data) {
        console.log(data);
    };
    return mysqlDb;
}());
var mysql = new mysqlDb();
mysql.add(art);
